package com.ttloner.admin.exception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author TTLoner
 * @date 2021/7/21 22:02
 * @description 处理整个web controller的异常
 */
@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler({ArithmeticException.class,NullPointerException.class})//处理的异常类型
    public String handleArithException(Exception e){
        log.error("异常是：{}",e);
        return  "login";
    }
}
